﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TweetMemeNET
{
    /// <summary>
    /// Provides helper methods for easy access to common TweetMeme.NET operations
    /// </summary>
    public static class TweetMeme
    {
        /// <summary>
        /// Shortcut for retrieving the number of retweets for a specific URL
        /// </summary>
        /// <param name="url">The URL to check on TweetMeme</param>
        /// <returns></returns>
        public static int GetNumberOfRetweets(string url)
        {
            return GetUrlInfo(url).NumberOfRetweets;
        }

        /// <summary>
        /// Shortcut for retrieving all Tweets in the last 7 days linking to the specified URL
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static List<Tweet> GetTweets(string url)
        {
            TweetMemeCallTweets caller = new TweetMemeCallTweets(url);

            if (caller.Result.Status==TweetMemeStatus.Success)
                return caller.Result.Tweets;
            else
                return new List<Tweet>();
        }

        /// <summary>
        /// Shortcut for retrieving all comments for the specified URL on TweetMeme
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static List<Comment> GetComments(string url)
        {
            TweetMemeCallComments caller = new TweetMemeCallComments(url);

            if (caller.Result.Status==TweetMemeStatus.Success)
                return caller.Result.Comments;
            else
                return new List<Comment>();
        }

        /// <summary>
        /// Shortcut for retrieving basic TweetMeme data for the specified URL
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static TweetMemeResultUrlInfo GetUrlInfo(string url)
        {
            return new TweetMemeCallUrlInfo(url).Result;
        }
    }
}
